<extend name="Public/base" />

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>竞拍商品列表[{$_total}]</h2>
	</div>
	<div class="cf">
		<div class="fl">
            <a class="btn" href="{:U('Product/add?type='.$_type)}">新 增</a>
            <button class="btn ajax-post confirm" url="{:U('Product/delete')}" target-form="ids">删 除</button>
        </div>
        
        <!-- 高级搜索 -->
		<div class="search-form cf fr">
			<div class="sleft">
				<input type="text" name="title" class="search-input" value="{:I('title')}" placeholder="请输入商品编号或标题">
				<a class="sch-btn" href="javascript:;" id="search" url="{:U('Product/'.$_type, false)}"><i class="btn-search"></i></a>
			</div>
            <div class="btn-group-click adv-sch-pannel fl">
                <button class="btn">高 级<i class="btn-arrowdown"></i></button>
                <div class="dropdown cf">
                	<div class="row">
                		<label>所在店铺：</label>
                		<input type="text" name="shop" class="text input-4x" value="" placeholder="请输入店铺编号或标题" />
                	</div>
                	<div class="row">
                		<label>所属会员：</label>
                		<input type="text" name="username" class="text input-4x" value="" placeholder="请输入用户编号或用户名">
                	</div>
                </div>
            </div>
		</div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table class="">
    <thead>
        <tr>
		<th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
		<th class="">编号</th>
		<th class="">商品名称</th>
		<th class="">商品分类</th>
		<th class="">价格</th>
		<th class="">数量</th>
		<th class="">所在店铺</th>
		<th class="">所属会员</th>
		<th class="">状态</th>
		<th class="">操作</th>
		</tr>
    </thead>
    <tbody>
		<notempty name="_list">
		<volist name="_list" id="vo">
		<tr>
            <td><input class="ids" type="checkbox" name="id[]" value="{$vo.id}" /></td>
			<td>{$vo.id} </td>
			<td>{$vo.title}</td>
			<td>{$vo.category_id|get_table_field=###,'id','title','product_category'}</td>
			<td>{$vo.price}</td>
			<td><span class="quantity">{$vo.quantity}</span></td>
			<td><span>{$vo.shop_id|get_table_field=###,'id','title','shop'}</span></td>
			<td><span>{$vo.uid|get_username}</span></td>
			<td>{$vo.status_text}</td>
			<td><a href="{:U('Product/edit?id='.$vo['id'])}">编辑</a></td>
		</tr>
		</volist>
		<else/>
		<td colspan="10" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>
	</tbody>
    </table>
	</div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
	<script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
	<script type="text/javascript">
	$(function(){
		//搜索功能
		$("#search").click(function(){
			var url = $(this).attr('url');
			var status = $("#sch-sort-txt").attr("data");
	        var query  = $('.search-form').find('input').serialize();
	        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
	        query = query.replace(/^&/g,'');
			
	        if( url.indexOf('?')>0 ){
	            url += '&' + query;
	        }else{
	            url += '?' + query;
	        }
			window.location.href = url;
		});
		
	    //回车自动提交
	    $('.search-form').find('input').keyup(function(event){
	        if(event.keyCode===13){
	            $("#search").click();
	        }
	    });
	    
	    //导航高亮
        highlight_subnav('{:U('Product/paipin')}');
	})
	</script>
</block>
